home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIPref.idl < prev    next >
Text File  |  2006-05-08  |  8KB  |  265 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Netscape Public License
  6.  * Version 1.1 (the "License"); you may not use this file except in
  7.  * compliance with the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/NPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is 
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *
  24.  * Alternatively, the contents of this file may be used under the terms of
  25.  * either the GNU General Public License Version 2 or later (the "GPL"), or 
  26.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27.  * in which case the provisions of the GPL or the LGPL are applicable instead
  28.  * of those above. If you wish to allow use of your version of this file only
  29.  * under the terms of either the GPL or the LGPL, and not to allow others to
  30.  * use your version of this file under the terms of the NPL, indicate your
  31.  * decision by deleting the provisions above and replace them with the notice
  32.  * and other provisions required by the GPL or the LGPL. If you do not delete
  33.  * the provisions above, a recipient may use your version of this file under
  34.  * the terms of any one of the NPL, the GPL or the LGPL.
  35.  *
  36.  * ***** END LICENSE BLOCK ***** */
  37.  
  38. #include "nsISupports.idl"
  39.  
  40. interface nsILocalFile;
  41. interface nsIObserver;
  42. interface nsIFileSpec;
  43.  
  44. #include "nsIPrefService.idl"
  45. #include "nsIPrefBranch.idl"
  46.  
  47. /*
  48.  * This entire interface is deprecated and should not be used.
  49.  * See nsIPrefService and nsIPrefBranch for the new implementations.
  50.  */
  51.  
  52. %{C++
  53.  
  54.  
  55. #ifndef have_PrefChangedFunc_typedef
  56. typedef int (*PR_CALLBACK PrefChangedFunc)(const char *, void *);
  57. #define have_PrefChangedFunc_typedef
  58. #endif
  59. typedef void (*PrefEnumerationFunc)(const char *, void *);
  60.  
  61. #define NS_PREF_CID                                    \
  62.   { /* {dc26e0e0-ca94-11d1-a9a4-00805f8a7ac4} */       \
  63.     0xdc26e0e0,                                        \
  64.     0xca94,                                            \
  65.     0x11d1,                                            \
  66.     { 0xa9, 0xa4, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xc4 } \
  67.   }
  68.  
  69. #define NS_PREF_CONTRACTID \
  70.   "@mozilla.org/preferences;1" 
  71.  
  72. #define NS_PREF_CLASSNAME "Preferences Service"
  73.  
  74. #define NS_PREF_VALUE_CHANGED 1 
  75. %}
  76. native PrefChangedFunc(PrefChangedFunc);
  77. native PrefEnumerationFunc(PrefEnumerationFunc);
  78.  
  79.  
  80. [scriptable, uuid(a22ad7b0-ca86-11d1-a9a4-00805f8a7ac4)]
  81. interface nsIPref : nsISupports {
  82.  
  83.   /*
  84.    * These are the the Prefs Service methods we will support for now
  85.    */
  86.  
  87.   /*
  88.    * readUserPrefs
  89.    * 
  90.    * read a user preference file, pass in null for default file
  91.    */
  92.   void readUserPrefs(in nsIFile aFile);
  93.  
  94.   /*
  95.    * resetPrefs
  96.    * 
  97.    * completely flush and reload the preferences system
  98.    */
  99.   void ResetPrefs();
  100.  
  101.   /*
  102.    * resetUserPrefs
  103.    * 
  104.    * flush all current user prefrences (reset all preferences to the default values)
  105.    */
  106.   void ResetUserPrefs();
  107.  
  108.   /*
  109.    * savePrefFile
  110.    * 
  111.    * write current preferences state to a file, pass in null for default file
  112.    */
  113.   void savePrefFile(in nsIFile aFile);
  114.  
  115.   /*
  116.    * branch operations
  117.    */
  118.  
  119.   nsIPrefBranch getBranch(in string aPrefRoot);
  120.   nsIPrefBranch getDefaultBranch(in string aPrefRoot);
  121.  
  122.  
  123.   /*
  124.    * These are the the Prefs Branch methods we will support for now
  125.    */
  126.  
  127.   const long ePrefInvalid = 0;
  128.   const long ePrefLocked = 1;
  129.   const long ePrefUserset = 2;
  130.   const long ePrefConfig = 4;
  131.   const long ePrefRemote = 8;
  132.   const long ePrefLilocal = 16;
  133.   const long ePrefString = 32;
  134.   const long ePrefInt = 64;
  135.   const long ePrefBool = 128;
  136.   const long ePrefValuetypeMask = (ePrefString | ePrefInt | ePrefBool);
  137.  
  138.   /*
  139.    * the root of this branch, such as "browser."
  140.    */
  141.   readonly attribute string root;
  142.  
  143.   /*
  144.    * standard methods for accessing preferences
  145.    */
  146.   long    GetPrefType(in string aPrefName);
  147.  
  148.   boolean GetBoolPref(in string aPrefName);
  149.   void    SetBoolPref(in string aPrefName, in long aValue);
  150.  
  151.   string  GetCharPref(in string aPrefName);
  152.   void    SetCharPref(in string aPrefName, in string aValue);
  153.  
  154.   long    GetIntPref(in string aPrefName);
  155.   void    SetIntPref(in string aPrefName, in long aValue);
  156.  
  157.   /*
  158.    * methods for accessing complex preferences (i.e. items beyond the simple bool, char, and int)
  159.    */
  160.   void getComplexValue(in string aPrefName, in nsIIDRef aType, [iid_is(aType), retval] out nsQIResult aValue);
  161.   void setComplexValue(in string aPrefName, in nsIIDRef aType, in nsISupports aValue);
  162.  
  163.   /*
  164.    * methods for preference state manipulation
  165.    */
  166.   void    ClearUserPref(in string aPrefName);
  167.   boolean PrefIsLocked(in string aPrefName);
  168.   void    lockPref(in string aPrefName);
  169.   void    unlockPref(in string aPrefName);
  170.  
  171.  
  172.   /*
  173.    * branch-level operations
  174.    */
  175.  
  176.   /*
  177.    * resetBranch
  178.    * 
  179.    * clears all user preferences starting at the given preference prefix
  180.    * pass in null or "" to clear this branch
  181.    */
  182.   void resetBranch(in string aStartingAt);
  183.  
  184.   /*
  185.    * deleteBranch
  186.    * 
  187.    * removes all preferences starting at the given preference prefix
  188.    * pass in null or "" to remove this branch
  189.    */
  190.   void DeleteBranch(in string aStartingAt);
  191.  
  192.   /*
  193.    * getChildList
  194.    *
  195.    * Returns an array of strings representing the child preferences of the branch root
  196.    * 
  197.    * @param startingAt pass in null or "" to enumerate the entire branch
  198.    * @param count Receives the number of elements in the array.
  199.    * @param childArray Receives the array of child preferences.
  200.    */
  201.   void getChildList(in string aStartingAt,
  202.                     out unsigned long aCount,
  203.                     [array, size_is(aCount), retval] out string aChildArray);
  204.  
  205.  
  206.   /*
  207.    * Listeners
  208.    */
  209.  
  210.   /*
  211.    * The observers have their |Observe| methods called with
  212.    * ([the observer], "nsPref:changed", [pref name]).
  213.    */
  214.   void addObserver(in string aDomain, in nsIObserver aObserver, in boolean aHoldWeak);
  215.   void removeObserver(in string aDomain, in nsIObserver aObserver);
  216.  
  217.  
  218.   /*
  219.    * Finally some deprecated methods
  220.    */
  221.  
  222.   
  223.   // these are changing from Copy->get
  224.   string CopyCharPref(in string pref);
  225.   string CopyDefaultCharPref(in string pref);
  226.  
  227.   /* get & set defaults */
  228.   boolean GetDefaultBoolPref(in string pref);
  229.   long    GetDefaultIntPref(in string pref);
  230.  
  231.   void SetDefaultBoolPref(in string pref, in boolean value);
  232.   void SetDefaultCharPref(in string pref, in string value);
  233.   void SetDefaultIntPref(in string pref, in long value);
  234.  
  235.   /* unichar & localized unichar prefs */
  236.   wstring CopyUnicharPref(in string pref);
  237.   wstring CopyDefaultUnicharPref(in string pref);
  238.   void SetUnicharPref(in string pref, in wstring value);
  239.   void SetDefaultUnicharPref(in string pref, in wstring value);
  240.   wstring getLocalizedUnicharPref(in string pref);
  241.   wstring getDefaultLocalizedUnicharPref(in string pref);
  242.  
  243.   /* file & filespec prefs */
  244.   nsIFileSpec  GetFilePref(in string pref);
  245.   void         SetFilePref(in string pref, in nsIFileSpec value, in boolean setDefault);
  246.   nsILocalFile getFileXPref(in string pref);
  247.   void         setFileXPref(in string pref, in nsILocalFile value);
  248.  
  249.   /* callbacks */
  250.   [noscript] void RegisterCallback(in string domain, in PrefChangedFunc callback, in voidPtr closure);
  251.   [noscript] void UnregisterCallback(in string domain, in PrefChangedFunc callback, in voidPtr closure);
  252.  
  253.   /**
  254.    * EnumerateChildren
  255.    *
  256.    * Call back function "callback" with every preference string
  257.    * having prefix "parent". Pass "data" to "callback" when calling.
  258.    * 
  259.    * @param parent A string representation of a prefix of preferences
  260.    * @param callback A function to call back for each matching preference
  261.    * @param data A piece of data to pass on to the callback
  262.    */
  263.   [noscript] void EnumerateChildren(in string parent, in PrefEnumerationFunc callback, in voidPtr data);
  264. };
  265.